<template>
  <el-table
    :data="tableData"
    size="small"
    style="width: 100%"
    :cell-style="{ backgroundColor: 'transparent' }"
    :row-style="{ backgroundColor: 'transparent' }"
    :header-row-style="{ backgroundColor: 'transparent' }"
    :header-cell-style="{ backgroundColor: 'transparent' }"
  >
    <el-table-column label="席位" width="80">
      <template #default="scope">
        <div style="font-weight: bolder">
          {{ scope.row.seatName }}
        </div>
      </template>
    </el-table-column>
    <el-table-column label="模块" min-width="120">
      <template #default="scope">
        <div>
          <el-tag
            v-for="model in scope.row.sectorCodes"
            size="small"
            class="tag-mini"
          >
            {{ model }}
          </el-tag>
        </div>
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup>
import { computed } from "vue";

const Props = defineProps({
  seatData: {
    type: Object,
    required: true,
  },
});
const tableData = computed(() =>
  Object.keys(Props.seatData).map((key) => ({
    seatName: key,
    sectorCodes: Props.seatData[key],
  }))
);
</script>

<style scoped>
.tag-mini {
  /* margin: 1px 2px; */
  /* padding: 1px 2px; */
  border-radius: 12px;
  margin: 2px;
  /* background-color: transparent; */
}
</style>
